<!DOCTYPE html>
<html>
<head>
    <title></title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
    <div v-show="showList == 1">
        <Row :gutter="16">
            <div class="search-group">
                <i-col span="4">
                    <i-input v-model="q.name" @on-enter="query" placeholder="名称"/>
                </i-col>
                <i-button @click="query">查询</i-button>
            </div>
            <div class="buttons-group">
                #if($shiro.hasPermission("userlevel:save"))
                <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                #end
                #if($shiro.hasPermission("userlevel:update"))
                <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                #end
                #if($shiro.hasPermission("userlevel:delete"))
                <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                #end
                #if($shiro.hasPermission("userlevel:rule"))
                <i-button type="info" @click="rule"><i class="fa fa-plus"></i>&nbsp;编辑规则</i-button>
                #end
            </div>
        </Row>
        <table id="jqGrid"></table>
        <div id="jqGridPager"></div>
    </div>

    <Card v-show="showList == 2">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate" :model="userLevel" :rules="ruleValidate" :label-width="80">
            <Form-item label="名称" prop="name">
                <i-input v-model="userLevel.name" placeholder="名称"/>
            </Form-item>
            <Form-item label="描述" prop="description">
                <i-input v-model="userLevel.description" placeholder="描述"/>
            </Form-item>
            <Form-item label="返佣比例" prop="commission">
                <Form-item style="display:inline-block">
                    <Input-number :min="0" :step="1" v-model="userLevel.commission" placeholder="返佣比例"
                                  style="width: 188px;"/>
                </Form-item>%
            </Form-item>
            <Form-item>
                <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/>
                返回</i-button>
                <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>

    <Card v-show="showList == 3">
        <p slot="title">{{title}}</p>
        <i-form ref="formValidate2" :model="userLevelRule" :label-width="200">
            <Form-item label="默认上级会员" prop="referrerId" style="width: 400px;">
                <i-select v-model="userLevelRule.param01" filterable>
                    <i-option v-for="item in users" :value="item.id" :key="item.username">{{item.nickname}}</i-option>
                </i-select>
            </Form-item>
            <Form-item label="折扣费停留">
                <Form-item style="display:inline-block">
                    折扣费停留<Input-number :min="1" :step="1" v-model="userLevelRule.param0"/>
                </Form-item>
                天后可以进入提现账户。
            </Form-item>
            <Form-item label="高级会员">
                <Form-item style="display:inline-block">
                    直接推荐 <Input-number :min="1" :step="1" v-model="userLevelRule.param1"/>
                </Form-item>
                个普通会员完成注册。
            </Form-item>
            <Form-item label="掌柜">
                <Form-item style="display:inline-block">
                    直接推荐<Input-number :min="1" :step="1" v-model="userLevelRule.param2"/>
                </Form-item>个会员完成注册并且直接+间接推荐人累计销售额>=
                <Form-item style="display:inline-block">
                    <Input-number :min="1" :step="1" v-model="userLevelRule.param3"/>
                </Form-item>元。
            </Form-item>
            <Form-item label="运营商">
                <Form-item style="display:inline-block">
                    发展<Input-number :min="1" :step="1" v-model="userLevelRule.param4"/>
                </Form-item>个掌柜并且直接+间接推荐人累计销售额>=
                <Form-item style="display:inline-block">
                    <Input-number :min="1" :step="1" v-model="userLevelRule.param5"/>
                </Form-item>元。
            </Form-item>
            <Form-item label="合伙人">
                <Form-item style="display:inline-block">
                    发展<Input-number :min="1" :step="1" v-model="userLevelRule.param6"/>
                </Form-item>运营商并且直接+间接推荐人累计销售额达到
                <Form-item style="display:inline-block">
                    <Input-number :min="1" :step="1" v-model="userLevelRule.param7"/>
                </Form-item>元。
            </Form-item>
            <Form-item>
                <i-button type="primary" @click="handleRuleSubmit()">提交</i-button>
                <i-button type="warning" @click="reload" style="margin-left: 8px"/>
                返回</i-button>
                <i-button type="ghost" @click="handleReset('formValidate2')" style="margin-left: 8px">重置</i-button>
            </Form-item>
        </i-form>
    </Card>

</div>

<script src="${rc.contextPath}/js/shop/userlevel.js?_${date.systemTime}"></script>
</body>
</html>